package edu.fiu.terminator;

/**
 * Terminate the training when iteration times is meet.
 *
 * @author Yexi Jiang (http://users.cis.fiu.edu/~yjian004/)
 * @date 2011-4-1
 */
public class IterationTerminator extends TrainingTerminator {

	private int threshold;
	private int iterations;
	
	public IterationTerminator(int times){
		this.threshold = times;
		this.iterations = 0;
	}
	
	@Override
	public boolean terminate() {
		if(iterations++ < threshold){
			return false;
		}
		return true;
	}
	
	public int iterationNumber(){
		return iterations;
	}

}
